org.apache.tools.ant.types.Reference Java Examples

The following examples show how to use org.apache.tools.ant.types.Reference. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GitSettingsTask.java    From ant-git-tasks with Apache License 2.0 6 votes vote down vote up
@Override
public void execute() throws BuildException {
        final GitSettings settings = new GitSettings();

        if (!GitTaskUtils.isNullOrBlankString(username) && !GitTaskUtils.isNullOrBlankString(password)) {
                settings.setCredentials(username, password);
        }

        if (!GitTaskUtils.isNullOrBlankString(name) && !GitTaskUtils.isNullOrBlankString(email)) {
                settings.setIdentity(name, email);
        }

        getProject().addReference(refId, new Reference(getProject(), refId) {
                        public GitSettings getReferencedObject(Project fallback) throws BuildException {
                                return settings;
                        }
                });
}
 
Example #2
Source File: AbstractGitTask.java    From ant-git-tasks with Apache License 2.0 5 votes vote down vote up
/**
 * Lookup the git settings for this task via a project reference
 *
 * @return The configured git settings for this task
 */
protected GitSettings lookupSettings() {
        if (getProject() != null && settingsRef != null) {
                Reference ref = (Reference) getProject().getReference(settingsRef);

                if (ref != null) {
                        GitSettings settings = (GitSettings) ref.getReferencedObject();

                        return settings;
                }
        }

        return null;
}
 
Example #3
Source File: IvyConfigureTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private Ivy getIvyInstance() {
    IvyTask task = new IvyTask() {
        public void doExecute() throws BuildException {
        }
    };
    task.setProject(project);
    task.init();

    Reference ref = new Reference(task.getProject(), configure.getSettingsId());
    // ref.setProject(project);
    task.setSettingsRef(ref);
    return task.getIvyInstance();
}
 
Example #4
Source File: IvyTaskTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test
public void testReferencedSettings() throws MalformedURLException {
    Project p = TestHelper.newProject();
    p.setProperty("myproperty", "myvalue");

    IvyAntSettings antSettings = new IvyAntSettings();
    antSettings.setProject(p);
    // antSettings.setId("mySettings");
    antSettings.setFile(new File("test/repositories/ivysettings.xml"));
    p.addReference("mySettings", antSettings);

    IvyTask task = new IvyTask() {
        public void doExecute() throws BuildException {
        }
    };
    task.setProject(p);
    task.setSettingsRef(new Reference(task.getProject(), "mySettings"));
    Ivy ivy = task.getIvyInstance();
    assertNotNull(ivy);
    IvySettings settings = ivy.getSettings();
    assertNotNull(settings);

    assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
    assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings
            .getVariables().getVariable("ivy.settings.file"));
    assertEquals(
        new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm(),
        settings.getVariables().getVariable("ivy.settings.url"));
    assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables()
            .getVariable("ivy.settings.dir"));
    assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
}
 
Example #5
Source File: FindBugsTask.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Adds a reference to a sourcepath defined elsewhere.
 *
 * @param r
 *            reference to a sourcepath defined elsewhere
 */
public void setAuxClasspathRef(Reference r) {
    Path path = createAuxClasspath();
    path.setRefid(r);
    path.toString(); // Evaluated for its side-effects (throwing a
    // BuildException)
}
 
Example #6
Source File: AbstractFindBugsTask.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Adds a reference to a classpath defined elsewhere.
 *
 * @param r
 *            reference to a classpath defined elsewhere
 */
public void setClasspathRef(Reference r) {
    Path path = createClasspath();
    path.setRefid(r);
    path.toString(); // Evaluated for its side-effects (throwing a
    // BuildException)
}
 
Example #7
Source File: IvyTask.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public Reference getSettingsRef() {
    return antIvyEngineRef;
}
 
Example #8
Source File: AntTask.java    From forbidden-apis with Apache License 2.0 4 votes vote down vote up
/** Classpath as classpathRef= attribute */
public void setClasspathRef(Reference r) {
  createClasspath().setRefid(r);
}
 
Example #9
Source File: GenStubsTask.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void setClasspathRef(Reference r) {
    createClasspath().setRefid(r);
}
 
Example #10
Source File: DelombokTask.java    From EasyMPermission with MIT License 4 votes vote down vote up
public void setClasspathRef(Reference r) {
	createClasspath().setRefid(r);
}
 
Example #11
Source File: DelombokTask.java    From EasyMPermission with MIT License 4 votes vote down vote up
public void setSourcepathRef(Reference r) {
	createSourcepath().setRefid(r);
}
 
Example #12
Source File: UberCompileTask.java    From groovy with Apache License 2.0 4 votes vote down vote up
public void setClasspathRef(final Reference r) {
    assert r != null;

    createClasspath().setRefid(r);
}
 
Example #13
Source File: CompileTaskSupport.java    From groovy with Apache License 2.0 4 votes vote down vote up
public void setClasspathRef(final Reference r) {
    assert r != null;
    
    createClasspath().setRefid(r);
}
 
Example #14
Source File: IvyTask.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public void setSettingsRef(Reference ref) {
    antIvyEngineRef = ref;
}
 
Example #15
Source File: BundleLocator.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void setClassPathRef(Reference r) {
  classPathRef = r;
}
 
Example #16
Source File: IvyResources.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public void setRefid(Reference ref) {
    wrapper.setRefid(ref);
}
 
Example #17
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setOldClassPathRef(Reference oldClassPathRef) {
	getOldClassPath().setRefid(oldClassPathRef);
}
 
Example #18
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setNewClassPathRef(Reference newClassPathRef) {
	getNewClassPath().setRefid(newClassPathRef);
}
 
Example #19
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setClassPathRef(Reference classPathRef) {
	getOldClassPath().setRefid(classPathRef);
	getNewClassPath().setRefid(classPathRef);
}
 
Example #20
Source File: MXJC2Task.java    From mxjc with MIT License 4 votes vote down vote up
public void setClasspathRef(Reference r) {
    classpath.createPath().setRefid(r);
}
 
Example #21
Source File: GenStubsTask.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void setClasspathRef(Reference r) {
    createClasspath().setRefid(r);
}
 
Example #22
Source File: GenStubsTask.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void setClasspathRef(Reference r) {
    createClasspath().setRefid(r);
}
 
Example #23
Source File: BaseGeneratorTask.java    From stategen with GNU Affero General Public License v3.0 4 votes vote down vote up
public void setClasspathRef(Reference r){
    this.classpath = new Path(getProject());
    this.classpath.setRefid(r);
}
 
Example #24
Source File: GenStubsTask.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void setClasspathRef(Reference r) {
    createClasspath().setRefid(r);
}
 
Example #25
Source File: CosUpdated.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void setRefid(Reference r) {
    throw tooManyAttributes();
}
 
Example #26
Source File: Sigtest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setClasspathRef(Reference r) {
    createClasspath().setRefid(r);
}
 
Example #27
Source File: InputOverride.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override public void setClasspathRef(Reference r) {
    delegate().setClasspathRef(r);
}
 
Example #28
Source File: InputOverride.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override public void setLoaderRef(Reference r) {
    delegate().setLoaderRef(r);
}
 
Example #29
Source File: GenStubsTask.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void setClasspathRef(Reference r) {
    createClasspath().setRefid(r);
}
 
Example #30
Source File: GenStubsTask.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void setClasspathRef(Reference r) {
    createClasspath().setRefid(r);
}