在Windows 10l中编译后,如何将openjdk9源代码导入Visual Studio 2017?

时间:2018-08-12 11:22:47

标签: jvm

我试图通过以下命令在Windows 10中构建openjdk9源代码

public class BlockedHandler : AuthorizationHandler<BlockedRequirement>
{
    private Task HandleBlockedAsync(AuthorizationFilterContext filterContext)
    {
        // create a model for the view if needed...
        var model = new BlockedModel();

        // do some processing if needed...

        var modelMetadataProvider = filterContext.HttpContext.RequestServices.GetService<IModelMetadataProvider>();
        // short-circuit request by setting the action result
        filterContext.Result = new ViewResult
        {
            StatusCode = 403, // Client cannot access the requested resource

            ViewName = "~/Views/Shared/Blocked.cshtml",
            ViewData = new ViewDataDictionary(modelMetadataProvider, filterContext.ModelState) { Model = model }
        };

        return Task.CompletedTask;
    }

    protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, BlockedRequirement requirement)
    {
        if (context.User.HasClaim(c => c.Type == UserClaimTypes.BlockedFrom) && 
            context.Resource is AuthorizationFilterContext filterContext &&
            filterContext.ActionDescriptor is ControllerActionDescriptor descriptor)
        {
            var allowBlocked = descriptor.ControllerTypeInfo.CustomAttributes
                .Concat(descriptor.MethodInfo.CustomAttributes)
                .Any(x => x.AttributeType == typeof(AllowBlockedAttribute));

            if (!allowBlocked)
                await HandleBlockedAsync(filterContext);
        }

        // We must return success in every case to avoid forbid/challenge.
        context.Succeed(requirement);
    }
}

最后,它成功构建并显示消息:

go to D:\jdk9\jdk9 with cygwin

./configure -with-freetype=/cygdrive/c/freetype -enable-debug -with-target-bits=64

make all 

但是如何将诸如jdk或Hotspot之类的项目导入Visual Studio? \ jdk9 \ hotspot \ make文件夹中既没有解决方案文件也没有生成项目文件,也没有create.bat文件(openjdk 8有该文件),因此如何将jdk / Hotspot源代码导入到Visual Studio中2017年调试源代码?

1 个答案:

答案 0 :(得分:1)

要构建VS Project Creator,请从openjdk9顶层目录运行以下命令:

make hotspot-ide-project

就我而言,生成的VS项目文件位于:

.../openjdk9/build/windows-x86_64-normal-server-slowdebug/ide/hotspot-visualstudio

最后,在jvm.vcxproj目录中找到hotspot-visualstudio文件并打开它。