Skip to content

Commit

Permalink
Refactor com.pants package to org.pantsbuild in examples and testproj…
Browse files Browse the repository at this point in the history
…ects

As discussed in previous PRs and pants-devel, we want to update our naming to refer to
the project's official domain name 'org.pantsbuild' This involves moving the example code
and testproject code to different directories and updating some publishing org/groupIds as well.

All of this refactoring was done mechanically with a script posted to the
group at https://groups.google.com/forum/#!topic/pants-devel/6K4Ee4wtJmk

Testing Done:
CI green at: https://travis-ci.org/pantsbuild/pants/builds/57378224

Bugs closed: 1371

Reviewed at https://rbcommons.com/s/twitter/r/2037/
  • Loading branch information
ericzundel committed Apr 7, 2015
1 parent 2d7fbf2 commit 4d76695
Show file tree
Hide file tree
Showing 308 changed files with 832 additions and 832 deletions.
12 changes: 6 additions & 6 deletions build-support/bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ if [[ "${skip_testprojects:-false}" == "false" ]]; then

# Targets that fail but shouldn't
known_failing_targets=(
testprojects/maven_layout/resource_collision/example_a/src/test/java/com/pants/duplicateres/examplea:examplea
testprojects/maven_layout/resource_collision/example_b/src/test/java/com/pants/duplicateres/exampleb:exampleb
testprojects/maven_layout/resource_collision/example_a/src/test/java/org/pantsbuild/duplicateres/examplea:examplea
testprojects/maven_layout/resource_collision/example_b/src/test/java/org/pantsbuild/duplicateres/exampleb:exampleb
)

# Targets that are intended to fail
negative_test_targets=(
testprojects/src/thrift/com/pants/thrift_linter:
testprojects/src/java/com/pants/testproject/missingdepswhitelist.*
testprojects/src/java/com/pants/testproject/cycle1
testprojects/src/java/com/pants/testproject/cycle2
testprojects/src/thrift/org/pantsbuild/thrift_linter:
testprojects/src/java/org/pantsbuild/testproject/missingdepswhitelist.*
testprojects/src/java/org/pantsbuild/testproject/cycle1
testprojects/src/java/org/pantsbuild/testproject/cycle2
testprojects/src/antlr/pants/backend/python/test:antlr_failure
testprojects/src/python/antlr:test_antlr_failure
)
Expand Down
2 changes: 1 addition & 1 deletion build-support/bin/publish_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function do_open() {
# generate html from markdown pages.
${PANTS_EXE} markdown \
--markdown-fragment src:: examples:: src/docs:: //:readme \
testprojects/src/java/com/pants/testproject/page:readme || \
testprojects/src/java/org/pantsbuild/testproject/page:readme || \
die "Failed to generate HTML from markdown'."

# invoke doc site generator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_validate(self):
ScroogeGen._validate(options, [self.target('test_validate:three')])

def test_smoke(self):
contents = dedent('''namespace java com.pants.example
contents = dedent('''namespace java org.pantsbuild.example
struct Example {
1: optional i64 number
}
Expand All @@ -106,7 +106,7 @@ def test_smoke(self):
task._outdir.return_value = self.task_outdir

task.gen = MagicMock()
sources = [os.path.join(self.task_outdir, 'com/pants/example/Example.scala')]
sources = [os.path.join(self.task_outdir, 'org/pantsbuild/example/Example.scala')]
task.gen.return_value = {'test_smoke/a.thrift': sources}

saved_add_new_target = Context.add_new_target
Expand Down
4 changes: 2 additions & 2 deletions examples/src/android/example/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
Licensed under the Apache License, Version 2.0 (see LICENSE).
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pants.examples.hello"
package="org.pantsbuild.example.hello"
android:versionCode="1"
android:versionName="1.0" >

Expand All @@ -18,7 +18,7 @@ Licensed under the Apache License, Version 2.0 (see LICENSE).
android:label="@string/appName">
android:theme="@style/AppTheme" >
<activity
android:name="com.pants.examples.hello.HelloWorld"
android:name="org.pantsbuild.example.hello.HelloWorld"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/appName">
android:theme="@style/FullscreenTheme" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.hello;
package org.pantsbuild.example.hello;

import android.app.Activity;
import android.content.res.Resources;
Expand Down
6 changes: 0 additions & 6 deletions examples/src/antlr/com/pants/examples/exp/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ options {
* target definition.
*/
@lexer::header {
package com.pants.examples.exp;
package org.pantsbuild.example.exp;
}

@parser::header {
package com.pants.examples.exp;
package org.pantsbuild.example.exp;
}


Expand Down
6 changes: 6 additions & 0 deletions examples/src/antlr/org/pantsbuild/example/exp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Sample Antlr grammar that evals mathematical expressions.

To see how Java code might use it, see:
- examples/src/java/org/pantsbuild/example/antlr3/
- examples/src/java/org/pantsbuild/example/antlr4/
- examples/tests/java/org/pantsbuild/example/useantlr/
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ statements in your Java code.

For example, your `BUILD` file might have

!inc[start-after=sources&end-before=src/java](../../../../../tests/java/com/pants/examples/hello/greet/BUILD)
!inc[start-after=sources&end-before=src/java](../../../../../tests/java/org/pantsbuild/example/hello/greet/BUILD)

And your Java code might have:

Expand Down Expand Up @@ -117,7 +117,7 @@ package, you can dump your dependency "tree" with versions with an Ivy resolve r
To generate a report for a target such as the `junit`-using `hello/greet` example tests:

:::bash
$ ./pants resolve.ivy --open examples/tests/java/com/pants/examples/hello/greet
$ ./pants resolve.ivy --open examples/tests/java/org/pantsbuild/example/hello/greet

Ivy's report shows which which package is pulling in the package-version you didn't expect.
(It might not be clear which version you *want*; but at least you've narrowed down the problem.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ page(
links=[
':3rdparty_jvm',
':from_maven',
'examples/src/scala/com/pants/example:readme',
'examples/src/scala/org/pantsbuild/example:readme',
'src/docs:publish',
'src/docs:first_concepts',
'src/docs:first_tutorial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE).


package com.pants.examples.annotation.example;
package org.pantsbuild.example.annotation.example;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

jvm_binary(name='main',
source='Main.java',
main='com.pants.examples.annotation.main.Main',
main='org.pantsbuild.example.annotation.main.Main',
basename = 'annotation-example',
dependencies=[
'examples/src/java/com/pants/examples/annotation/example',
'examples/src/java/com/pants/examples/annotation/processor',
'examples/src/java/org/pantsbuild/example/annotation/example',
'examples/src/java/org/pantsbuild/example/annotation/processor',
],
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.annotation.main;
package org.pantsbuild.example.annotation.main;

import com.pants.examples.annotation.example.Example;
import org.pantsbuild.example.annotation.example.Example;

/**
* Demonstrates the use of annotation_processor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

annotation_processor(name='processor',
sources=['ExampleProcessor.java'],
processors=['com.pants.examples.annotation.processor.ExampleProcessor'],
processors=['org.pantsbuild.example.annotation.processor.ExampleProcessor'],
dependencies=[
'examples/src/java/com/pants/examples/annotation/example',
'examples/src/java/org/pantsbuild/example/annotation/example',
'3rdparty:guava',
],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.annotation.processor;
package org.pantsbuild.example.annotation.processor;

import com.google.common.collect.ImmutableSet;
import com.google.common.io.Closer;
import com.pants.examples.annotation.example.Example;
import org.pantsbuild.example.annotation.example.Example;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

jvm_binary(name='antlr3',
source='ExampleAntlr3.java',
main='com.pants.examples.antlr3.ExampleAntlr3',
main='org.pantsbuild.example.antlr3.ExampleAntlr3',
dependencies=[
'examples/src/antlr/com/pants/examples/exp:exp_antlr3',
'examples/src/antlr/org/pantsbuild/example/exp:exp_antlr3',
],
)

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.antlr3;
package org.pantsbuild.example.antlr3;

import org.antlr.runtime.*;
import com.pants.examples.exp.ExpAntlr3Lexer;
import com.pants.examples.exp.ExpAntlr3Parser;
import org.pantsbuild.example.exp.ExpAntlr3Lexer;
import org.pantsbuild.example.exp.ExpAntlr3Parser;

/**
* An example for parsing mathematical expressions using Antlr version 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

jvm_binary(name='antlr4',
source='ExampleAntlr4.java',
main='com.pants.examples.antlr4.ExampleAntlr4',
main='org.pantsbuild.example.antlr4.ExampleAntlr4',
dependencies=[
'examples/src/antlr/com/pants/examples/exp:exp_antlr4',
'examples/src/antlr/org/pantsbuild/example/exp:exp_antlr4',
],
)

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.antlr4;
package org.pantsbuild.example.antlr4;

import org.antlr.v4.runtime.*;
import com.pants.examples.exp.ExpAntlr4Lexer;
import com.pants.examples.exp.ExpAntlr4Parser;
import org.pantsbuild.example.exp.ExpAntlr4Lexer;
import org.pantsbuild.example.exp.ExpAntlr4Parser;

/**
* An example parser for mathematical expressions using Antlr version 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ chose one version, but Pants might end up choosing another: Pants is
likely to generate a differently-ordered `CLASSPATH` than Maven did. You
can fix these, making your build configuration more robust along the
way; see
[[JVM 3rdparty Pattern|pants('examples/src/java/com/pants/examples:3rdparty_jvm')]]
[[JVM 3rdparty Pattern|pants('examples/src/java/org/pantsbuild/example:3rdparty_jvm')]]
for advice.

Pants Equivalents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ java_library(name = 'greet',
dependencies = [], # A more realistic example would depend on other libs,
# but this "hello world" is pretty simple.
sources = globs('*.java'),
provides = artifact(org='com.pants.examples',
provides = artifact(org='org.pantsbuild.example',
name='hello-greet',
repo=public,),
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.hello.greet;
package org.pantsbuild.example.hello.greet;

import java.io.FileInputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jvm_app(name='main',

jvm_binary(name = 'main-bin',
dependencies = [
'examples/src/java/com/pants/examples/hello/greet',
'examples/src/java/org/pantsbuild/example/hello/greet',
],
resources=[
'examples/src/resources/com/pants/example/hello',
'examples/src/resources/org/pantsbuild/example/hello',
],
source = 'HelloMain.java',
main = 'com.pants.examples.hello.main.HelloMain',
main = 'org.pantsbuild.example.hello.main.HelloMain',
basename = 'hello-example',
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.hello.main;
package org.pantsbuild.example.hello.main;

import java.io.IOException;

import com.pants.examples.hello.greet.Greeting;
import org.pantsbuild.example.hello.greet.Greeting;

public class HelloMain {

Expand All @@ -14,7 +14,7 @@ public static void main(String[] args) throws IOException {
System.out.println(Greeting.greetFromFile("greetee.txt"));

// Target of other greeting is config'd in resource, so read that:
System.out.println(Greeting.greetFromResource("com/pants/example/hello/world.txt"));
System.out.println(Greeting.greetFromResource("org/pantsbuild/example/hello/world.txt"));
}

private HelloMain() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

jvm_binary(name = 'simple',
source = 'HelloWorld.java',
main = 'com.pants.examples.hello.simple.HelloWorld',
main = 'org.pantsbuild.example.hello.simple.HelloWorld',
)

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.hello.simple;
package org.pantsbuild.example.hello.simple;

/**
* A simple example that is runnable from within pants:
*
* ./pants run examples/src/java/com/pants/examples/hello/simple
* ./pants run examples/src/java/org/pantsbuild/example/hello/simple
*
*/
public class HelloWorld {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
java_library(name = 'java_sources',
sources = globs('*.java'),
dependencies = [
'examples/src/scala/com/pants/example/scala_with_java_sources',
'examples/src/scala/org/pantsbuild/example/scala_with_java_sources',
],
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.java_sources;
package org.pantsbuild.example.java_sources;

public class Greet {
public static String greet(String message){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.pants.examples.java_sources;
package org.pantsbuild.example.java_sources;

import java.io.IOException;

import com.pants.examples.scala_with_java_sources.GreetEverybody;
import org.pantsbuild.example.scala_with_java_sources.GreetEverybody;

public class GreetMain {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
jvm_binary(name='main',
basename='jaxb-example',
dependencies=[
'examples/src/java/com/pants/examples/jaxb/reader',
'examples/src/resources/com/pants/example/names',
'examples/src/java/org/pantsbuild/example/jaxb/reader',
'examples/src/resources/org/pantsbuild/example/names',
],
source='ExampleJaxb.java',
main='com.pants.examples.jaxb.main.ExampleJaxb',
main='org.pantsbuild.example.jaxb.main.ExampleJaxb',
)
Loading

0 comments on commit 4d76695

Please sign in to comment.