Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Commit

Permalink
Merge branch 'gradle' into update-#46
Browse files Browse the repository at this point in the history
Conflicts:
	build.gradle
	gradle/wrapper/gradle-wrapper.jar
	gradle/wrapper/gradle-wrapper.properties
  • Loading branch information
dcendents committed Aug 15, 2016
2 parents 0ef4be2 + 489280b commit 376a5ea
Show file tree
Hide file tree
Showing 101 changed files with 9,127 additions and 19 deletions.
39 changes: 35 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id "org.ysb33r.gradletest" version "0.5.5"
}

apply plugin: 'groovy'
apply plugin: "nu.studer.plugindev"
apply plugin: "jacoco"
apply plugin: "maven"
Expand All @@ -15,6 +16,12 @@ repositories {
}

sourceSets {
test {
groovy {
srcDirs = ['src/test/groovy', 'src/test/core/src/testFixtures/groovy', 'src/test/internal-testing/src/main/groovy' ]
}
}

integTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
Expand All @@ -27,6 +34,7 @@ configurations {
}

dependencies {
compile gradleApi()

// from gradle/gradle/dependencies.gradle
compileOnly dependencies.module("org.apache.maven:maven-core:3.0.4") {
Expand Down Expand Up @@ -69,9 +77,32 @@ dependencies {
dependency 'org.sonatype.aether:aether-connector-wagon:1.13.1@jar'
}

gradleTest 'com.android.tools.build:gradle:2.2.0-beta1'

testCompile 'junit:junit:4.12',
'org.hamcrest:hamcrest-all:1.3'
gradleTest 'com.android.tools.build:gradle:2.1.2'
'org.hamcrest:hamcrest-all:1.3',
// from gradle/subprojects/core/core.gradle, gradle/subprojects/internal-testing/internal-testing.gradle and gradle/gradle/dependencies.gradle
'commons-io:commons-io:2.2',
'commons-lang:commons-lang:2.6@jar',
'org.spockframework:spock-core:1.0-groovy-2.4@jar',
"org.codehaus.groovy:groovy-all:2.4.7",
'org.objenesis:objenesis:1.2@jar',
'cglib:cglib-nodep:2.2.2',
'org.jmock:jmock:2.5.1',
dependencies.create('org.jmock:jmock-junit4:2.5.1') { exclude group: 'junit', module: 'junit-dep' }, //junit-dep pulls old definitions of core junit types.
'org.jmock:jmock-legacy:2.5.1',
'com.google.guava:guava-jdk5:17.0@jar',
'org.jsoup:jsoup:1.6.3',
'com.google.code.findbugs:jsr305:1.3.9@jar',
'org.ow2.asm:asm-all:5.1'

testCompile dependencies.module('org.apache.ivy:ivy:2.2.0'){
dependency "com.jcraft:jsch:0.1.53"
}

testCompile dependencies.module('org.apache.ant:ant:1.9.6') {
dependency 'org.apache.ant:ant-launcher:1.9.6@jar'
}
}

sourceCompatibility = 1.6
Expand Down Expand Up @@ -140,7 +171,7 @@ pluginBundle {
}

ext {
gradleVersions = '2.14,2.14.1'
gradleVersions = '3.0'
}

task integTest(type: Test) {
Expand Down Expand Up @@ -187,6 +218,6 @@ jacocoTestReport.dependsOn test
check.dependsOn jacocoTestReport

task wrapper(type: Wrapper) {
gradleVersion = '2.14.1'
gradleVersion = '3.0'
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jul 21 19:45:49 EDT 2016
#Mon Aug 15 11:03:23 EDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-all.zip
5 changes: 5 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,9 @@ function splitJvmOpts() {
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
6 changes: 0 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/gradle/api/plugins/AndroidMavenPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.gradle.api.artifacts.maven.MavenPom;
import org.gradle.api.artifacts.maven.MavenResolver;
import org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier;
import org.gradle.api.internal.artifacts.ModuleInternal;
import org.gradle.api.internal.artifacts.Module;
import org.gradle.api.internal.artifacts.configurations.ConfigurationInternal;
import org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler;
import org.gradle.api.internal.artifacts.ivyservice.projectmodule.DefaultProjectPublication;
Expand Down Expand Up @@ -164,7 +164,7 @@ public void execute(Project project) {
}

ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
ModuleInternal module = configuration.getModule();
Module module = configuration.getModule();
for (MavenResolver resolver : uploadArchives.getRepositories().withType(MavenResolver.class)) {
MavenPom pom = resolver.getPom();
ModuleVersionIdentifier publicationId = new DefaultModuleVersionIdentifier(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.gradle.api

import org.apache.tools.ant.BuildEvent
import org.apache.tools.ant.BuildListener

class RecordingAntBuildListener implements BuildListener {

List<BuildEvent> buildStarted = []
List<BuildEvent> buildFinished = []
List<BuildEvent> targetStarted = []
List<BuildEvent> targetFinished = []
List<BuildEvent> taskStarted = []
List<BuildEvent> taskFinished = []
List<BuildEvent> messageLogged = []

void buildStarted(BuildEvent event) {
buildStarted << event
}

void buildFinished(BuildEvent event) {
buildFinished << event
}

void targetStarted(BuildEvent event) {
targetStarted << event
}

void targetFinished(BuildEvent event) {
targetFinished << event
}

void taskStarted(BuildEvent event) {
taskStarted << event
}

void taskFinished(BuildEvent event) {
taskFinished << event
}

void messageLogged(BuildEvent event) {
messageLogged << event
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.gradle.api.file;

import org.gradle.api.internal.file.CompositeFileCollection;
import org.gradle.api.internal.file.TestFiles;
import org.gradle.api.internal.file.UnionFileCollection;
import org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection;
import org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public class FileCollectionMatchers {
@Factory
public static <T extends FileCollection> Matcher<T> sameCollection(final FileCollection expected) {
return new BaseMatcher<T>() {
public boolean matches(Object o) {
FileCollection actual = (FileCollection) o;
List<? extends FileCollection> actualCollections = unpack(actual);
List<? extends FileCollection> expectedCollections = unpack(expected);
boolean equals = actualCollections.equals(expectedCollections);
if (!equals) {
System.out.println("expected: " + expectedCollections);
System.out.println("actual: " + actualCollections);
}
return equals;
}

private List<? extends FileCollection> unpack(FileCollection expected) {
if (expected instanceof UnionFileCollection) {
UnionFileCollection collection = (UnionFileCollection) expected;
return new ArrayList<FileCollection>(collection.getSources());
}
if (expected instanceof DefaultConfigurableFileCollection) {
DefaultConfigurableFileCollection collection = (DefaultConfigurableFileCollection) expected;
return new ArrayList<FileCollection>((Set) collection.getFrom());
}
if (expected instanceof CompositeFileCollection) {
CompositeFileCollection collection = (CompositeFileCollection) expected;
DefaultFileCollectionResolveContext context = new DefaultFileCollectionResolveContext(TestFiles.resolver());
collection.visitContents(context);
return context.resolveAsFileCollections();
}
throw new RuntimeException("Cannot get children of " + expected);
}

public void describeTo(Description description) {
description.appendText("same file collection as ").appendValue(expected);
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.internal.file;

import org.gradle.api.internal.file.collections.DefaultDirectoryFileTreeFactory;
import org.gradle.api.internal.file.collections.DirectoryFileTreeFactory;
import org.gradle.api.tasks.util.PatternSet;
import org.gradle.api.tasks.util.internal.PatternSets;
import org.gradle.internal.Factory;
import org.gradle.internal.nativeintegration.filesystem.FileSystem;
import org.gradle.process.internal.DefaultExecActionFactory;
import org.gradle.process.internal.ExecActionFactory;
import org.gradle.process.internal.ExecHandleFactory;
import org.gradle.process.internal.JavaExecHandleFactory;
import org.gradle.testfixtures.internal.NativeServicesTestFixture;

import java.io.File;

public class TestFiles {
private static final FileSystem FILE_SYSTEM = NativeServicesTestFixture.getInstance().get(FileSystem.class);
private static final DefaultFileLookup FILE_LOOKUP = new DefaultFileLookup(FILE_SYSTEM, PatternSets.getNonCachingPatternSetFactory());

public static FileLookup fileLookup() {
return FILE_LOOKUP;
}

public static FileSystem fileSystem() {
return FILE_SYSTEM;
}

/**
* Returns a resolver with no base directory.
*/
public static FileResolver resolver() {
return FILE_LOOKUP.getFileResolver();
}

/**
* Returns a resolver with the given base directory.
*/
public static FileResolver resolver(File baseDir) {
return FILE_LOOKUP.getFileResolver(baseDir);
}

public static DirectoryFileTreeFactory directoryFileTreeFactory() {
return new DefaultDirectoryFileTreeFactory();
}

public static FileCollectionFactory fileCollectionFactory() {
return new DefaultFileCollectionFactory();
}

public static SourceDirectorySetFactory sourceDirectorySetFactory() {
return new DefaultSourceDirectorySetFactory(resolver(), new DefaultDirectoryFileTreeFactory());
}

public static SourceDirectorySetFactory sourceDirectorySetFactory(File baseDir) {
return new DefaultSourceDirectorySetFactory(resolver(baseDir), new DefaultDirectoryFileTreeFactory());
}

public static ExecActionFactory execActionFactory() {
return new DefaultExecActionFactory(resolver());
}

public static ExecHandleFactory execHandleFactory() {
return new DefaultExecActionFactory(resolver());
}

public static ExecHandleFactory execHandleFactory(File baseDir) {
return new DefaultExecActionFactory(resolver(baseDir));
}

public static JavaExecHandleFactory javaExecHandleFactory(File baseDir) {
return new DefaultExecActionFactory(resolver(baseDir));
}

public static Factory<PatternSet> getPatternSetFactory() {
return resolver().getPatternSetFactory();
}
}
Loading

0 comments on commit 376a5ea

Please sign in to comment.