Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MASSEMBLY-775] for review #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ under the License.
</includes>
</fileSet>
<fileSet>
<!-- This points to an absolute path on the current drive -->
<directory>/src/test/java/test</directory>
<outputDirectory>conf</outputDirectory>
<includes>
Expand Down
37 changes: 37 additions & 0 deletions src/it/projects/file-sets/massembly-665/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import java.io.*;
import java.net.*;
import java.util.jar.*;

boolean result = true;

try
{
result = new File( basedir, "target/massembly-665-1.0-SNAPSHOT-src/bin/aFile.txt" ).exists() &&
!new File( basedir, "target/massembly-665-1.0-SNAPSHOT-src/conf/aFile.txt" ).exists();
}
catch( IOException e )
{
e.printStackTrace();
result = false;
}

return result;
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public void execute( final Assembly assembly, final Archiver archiver,

final String outputDirectory1 = fileItem.getOutputDirectory();

AssemblyFormatUtils.warnForPlatformSpecifics( getLogger(), outputDirectory1 );

final String outputDirectory =
AssemblyFormatUtils.getOutputDirectory( outputDirectory1, configSource.getFinalName(), configSource,
AssemblyFormatUtils.moduleProjectInterpolator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ void addFileSet( final FileSet fileSet, final Archiver archiver, final Assembler
if ( destDirectory == null )
{
destDirectory = fileSet.getDirectory();

AssemblyFormatUtils.warnForPlatformSpecifics( logger, destDirectory );
}

AssemblyFormatUtils.warnForPlatformSpecifics( logger, destDirectory );

destDirectory =
AssemblyFormatUtils.getOutputDirectory( destDirectory, configSource.getFinalName(), configSource,
Expand Down Expand Up @@ -186,7 +187,12 @@ File getFileSetDirectory( final FileSet fileSet, final File basedir, final File
{
fileSetDir = new File( sourceDirectory );

if ( !fileSetDir.isAbsolute() )
// If the file is not absolute then it's a subpath of the current project basedir
// For OS compatibility we also must treat any path starting with "/" as absolute
// as File#isAbsolute() returns false for /absolutePath under Windows :(
// Note that in Windows an absolute path with / will be on the 'current drive'.
// But I think we can live with this.
if ( !fileSetDir.isAbsolute() && !fileSetDir.getPath().startsWith( "/" ) )
{
fileSetDir = new File( basedir, sourceDirectory );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ public void testExecute_WithOutputDirectory()
macLogger.logger.error( "OS=Windows and the assembly descriptor contains a *nix-specific "
+ "root-relative reference (starting with slash): /" );
}
else
{
macLogger.logger.warn( (String) anyObject() );
}

final MockAndControlForArchiver macArchiver = new MockAndControlForArchiver( mm );

Expand Down Expand Up @@ -272,15 +268,6 @@ public void testExecute_WithOutputDirectoryAndDestName()
macCS.expectInterpolators();

final MockAndControlForLogger macLogger = new MockAndControlForLogger( mm );
if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
{
macLogger.logger.error( "OS=Windows and the assembly descriptor contains a *nix-specific "
+ "root-relative reference (starting with slash): /" );
}
else
{
macLogger.logger.warn( (String) anyObject() );
}

final MockAndControlForArchiver macArchiver = new MockAndControlForArchiver( mm );

Expand Down